package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"video/global"
	"video/initialize"
	"video/models"
)

func main() {
	//numCPUs := runtime.NumCPU()
	//fmt.Printf("Number of CPUs: %d\n", numCPUs)
	//初始化读取已经完成解析的视屏
	initialize.InitImages()
	// 遍历目录并处理视频
	err := models.WalkVideos(global.VideoDirPath)
	if err != nil {
		fmt.Printf("执行失败：路径 %s 错误原因: %v\n", global.VideoDirPath, err)
		return
	}
	fmt.Println("执行完成")
	r := gin.Default()
	r.GET("/", func(context *gin.Context) {
		context.JSON(200, global.ShowList)
	})
	r.Run()
}
